import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect,
} from 'react-router-dom';

// 项目页面
import { Login } from '@/pages/Login/Login';
import { GeekLayout } from '@/pages/GeekLayout/GeekLayout';
import { NotFound } from '@/pages/NotFound/NotFound';

// 根组件样式
import './App.scss';

export const App = () => {
  return (
    <Router>
      <div className="app">
        <Switch>
          {/* “/” 匹配路由组件 */}
          <Route exact path={'/'} render={() => <Redirect to={'/home'} />} />
          {/* 管理页面 */}
          <Route path={'/home'} component={GeekLayout} />
          {/* 登录页面 */}
          <Route path={'/login'} component={Login} />
          {/* 404页面 */}
          <Route component={NotFound} />
        </Switch>
      </div>
    </Router>
  );
};
